import request from '@/utils/request'

/**
 * 字典
 */
export function getDictByCode(dictCode) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/getDictByCode',
    method: 'POST',
    data: { dictCode }
  })
}

/**
 * 获取系统名称/主题色
 */
export function getDataByType(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sys/sysConfig/getByName',
    method: 'post',
    data
  })
}
/**
 * 设置系统名称/主题色
 */
export function setDataByType(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sys/sysConfig/updateByName',
    method: 'post',
    data
  })
}

/**
 * 获取企业信息
 */
export function getEnterpriseInfo(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/getEnterpriseInfo',
    method: 'post',
    data
  })
}

// 添加特殊配置
export function sysDesensitizationConfigInseter(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDesensitizationConfig/insert',
    method: 'post',
    data
  })
}
// 查询特殊配置页面
export function sysDesensitizationConfigQueryPage(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDesensitizationConfig/queryPage',
    method: 'post',
    data
  })
}
// 修改状态
export function sysDesensitizationConfigUpdate(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDesensitizationConfig/update',
    method: 'post',
    data
  })
}
// /  删除
export function sysDesensitizationConfigDelete(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: 'backend/sysDesensitizationConfig/deleteById',
    method: 'post',
    data
  })
}
// 修改特殊配置
export function sysDesensitizationConfiguUpdateStatus(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDesensitizationConfig/updateStatus',
    method: 'post',
    data
  })
}
// 模块配置保存
export function save(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sys/sysConfig/updateByName',
    method: 'post',
    data
  })
}

// 获取字典
export function getDic(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/getDictByCode',
    method: 'post',
    data
  })
}

// 获取新闻管理分类
export function queryNewTypes(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/newsClassify/getClassifyTree',
    method: 'post',
    data: {
      classifyType: 'XWFL_XWGL'
    }
  })
}

/**
 * 选择数据列表查询
 */
export function queryPage(type, data) {
  const url = type === 'live' ? '/backend/liveActivity/queryPage' : '/backend/info/cxgzs/queryPage'
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: url,
    method: 'POST',
    data
  })
}

/**
 * 选择闯关关口查询
 */
export function queryEmigratedPage(type, data) {
  const url = type === 'everyday' ? '/backend/breakthroughDaily/queryPage' : 'backend/breakthroughActivity/queryPage'
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: url,
    method: 'POST',
    data
  })
}
/**
 * 查询答题活动
 */
export function queryPageActivity(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/specialAnswers/queryPage',
    method: 'post',
    data
  })
}
/**
 * 查询专项答题列表
 */
export function queryPageZXDT(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    // url: '/backend/dailyRactice/queryPage',
    url: '/backend/specialAnswers/queryPage',
    method: 'post',
    data
  })
}
/**
 * 查询日历的数据
 */
export function queryCalendar(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/dailyFocus/queryByDate',
    method: 'post',
    data
  })
}
/**
  * 每日一练分页
  * @param {*} data
  */
export function queryPageCourse(data, t) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    // url: '/backend/dailyRactice/queryPage',
    url: t === 'DTLX_SYMRLX' ? '/backend/rushQuestions/queryPage' : '/backend/dailyRactice/queryPage',
    method: 'post',
    data
  })
}
// 获取系统配置
export function getConfig(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sys/sysConfig/getByName',
    method: 'post',
    data
  })
}
// 每周重点新增
export function weekFocueInsert(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/dailyFocus/insert',
    method: 'post',
    data
  })
}
// 每周重点新增
export function newInsert(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sys/sysConfig/insert',
    method: 'post',
    data
  })
}
// 每周重点置顶
export function weekFocueTop(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/dailyFocus/updateTop',
    method: 'post',
    data
  })
}
// 每周重点删除
export function weekFocueDelete(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/dailyFocus/deleteById',
    method: 'post',
    data
  })
}
// 每周重点删除
export function weekFocueUpdateTime(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/dailyFocus/getUpdTime',
    method: 'post',
    data
  })
}

